<?php
$token = isset($_GET['t'])?$_GET['t']:null;
if(!$token)return;
require_once '../providerConstants.php';
$mysqli = new mysqli($dbHost,$dbUser,$dbPass,$db);
$deleteSql = 'delete FROM provider_master WHERE insertTs < (NOW() - INTERVAL 1 hour) and tempToken is not null';
$stmt = $mysqli->prepare($deleteSql);
$stmt->execute();
$sql = 'update provider_customer set tempToken = null where tempToken = ?';
$stmt = $mysqli->prepare($sql);
$stmt->bind_param('s',$token);
if($stmt->execute()){
	$count = $stmt->affected_rows;
	if($count!=1)return;
	echo 'registration confirmed.  proceed to <a href="http://provider.rostego.com">provider.rostego.com</a>';
}
?>
